// popup.js
document.getElementById('loadBtn').addEventListener('click', () => {
  // 请求后台存储的数据
  chrome.runtime.sendMessage({ type: 'getTableData' }, response => {
    debugger
    const data = response.data;
    const container = document.getElementById('tableContainer');
    container.innerHTML = '';

    if (!data || data.length === 0) {
      container.innerText = '没有提取到数据或数据为空';
      return;
    }

    // 创建表格
    const table = document.createElement('table');
    data.forEach((row, rowIndex) => {
      const tr = document.createElement('tr');
      row.forEach((cell, cellIndex) => {
        const cellElement = rowIndex === 0 ? document.createElement('th') : document.createElement('td');
        cellElement.innerText = cell;
        tr.appendChild(cellElement);
      });
      table.appendChild(tr);
    });
    container.appendChild(table);
  });
});



